﻿@model Model.SysUserInfo
@{
    ViewBag.Title = "UserEdit";
    Layout = "~/Views/Shared/_Main.cshtml";
}
<style type="text/css">
    textarea
    {
        width: 400px;
        border: 1px solid #ccc;
        padding: 2px;
    }
    .pwdw{ width:148px;}
</style>
<script type="text/javascript">
    function SubmitForm() {
        if ($('#ff').form("validate")) {
            var result = $("#Username").val().match(/^\w+$/);
            if (result == null) {
                alert("用户名格式不正确，只能由数字、英文字母或者下划线组成!");
                return false;
            }
            $('#ff').form('submit');
            alert("操作成功！");
            BackToList();
        }
    }
    function CheckUserName(u) {
        $.post("/SysUser/CheckUserName/?userName=" + encodeURI(u), function (res) {
            if (res != "OK") {
                alert(res);
                $("#Save").attr("disabled", "disabled");
            }
            else
                $("#Save").removeAttr("disabled");
        }); 
    }
    function BackToList() {
        window.location.href = "/SysUser/UserList";
    }
  
</script>
<link href="../../CSS/PageStyle.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/Validator.js" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<div style="margin: 5px;">
    <div id="p" class="easyui-panel" style="width: 800px; padding: 10px 5px 10px 5px;"
        data-options="title:'用户信息编辑',iconCls:'icon-edit'">
        <form id="ff" action="/SysUser/UserUpdate" method="post">
        <table style="width: 780px" cellpadding="0" cellspacing="0" class="table_bg">
            <colgroup>
                <col style="width: 27%;" />
                <col style="width: 73%;" />
            </colgroup>
            <tr>
                <td style="text-align: right;">
                    姓名：
                </td>
                <td>
                    <input type="text" name="EmployeeName" value="@Model.EmployeeName" class="easyui-validatebox" data-options="required:true"/>
                    @Html.HiddenFor(model => model.Guid)
                    @Html.HiddenFor(model => model.EmployeeCode)
                </td>
            </tr> 
            <tr>
                <td style="text-align: right;">
                    办工电话：
                </td>
                <td> 
                    <input type="text" name="OfficeTel" value="@Model.OfficeTel" class="easyui-validatebox"  validType="phone"/>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    家庭电话：
                </td>
                <td>
                    <input type="text" name="HomeTel" value="@Model.HomeTel" class="easyui-validatebox" validType="phone"/>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    手机：
                </td>
                <td>
                    <input type="text" name="Mobile" value="@Model.Mobile" class="easyui-validatebox" validType="mobile"/>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    性别：
                </td>
                <td>
                    @Html.DropDownListFor(model => model.Gender, WebPortal.Controllers.PEParaController.SelectList("Sex"))
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    EMAIL：
                </td>
                <td>
                    <input type="text" name="OfficeEmail" value="@Model.OfficeEmail" class="easyui-validatebox" data-options="required:true" validType="email"/>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    用户名：
                </td>
                <td>
                    <input type="text" onchange="CheckUserName(this.value);" name="Username" ID="Username" value="@Model.Username" @(Model.Username!=null ? "disabled='disabled'" : "")  class="easyui-validatebox" data-options="required:true"/>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    用户密码：
                </td>
                <td>
                    <input type="password" id="password" name="Pwd" value="@Model.Pwd" class="easyui-validatebox pwdw" data-options="required:true" />
                    <input type="hidden" name="OldPwd" value="@Model.Pwd" />
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    确认密码：
                </td>
                <td>
                    <input type="password" name="Pwd" value="@Model.Pwd" style="width:230x;" class="easyui-validatebox pwdw" data-options="required:true" validType="same['password']"/>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    状态：
                </td>
                <td>
                    @Html.DropDownListFor(model => model.Status, WebPortal.Controllers.PEParaController.SelectList("Status"))
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    公司：
                </td>
                <td>
                    <input type="text" style="width:95%;" name="CompanyName" value="@Model.CompanyName" class="easyui-validatebox" />
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    部门：
                </td>
                <td>
                    <input type="text" style="width:95%;" name="Department" value="@Model.Department" class="easyui-validatebox" />
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    岗位：
                </td>
                <td>
                    <input type="text" name="Post" value="@Model.Post" class="easyui-validatebox"/>
                </td>
            </tr>
            <tr>
                <td style="border-top: 0px; text-align: center" colspan="2">
                    <input id="Save" type="button" value=" 保存 " onclick="SubmitForm()" />
                    <input type="button" value=" 返回 " onclick="BackToList();" />
                    @*<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" onclick="SubmitForm()">
                    保存</a> &nbsp;&nbsp; <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-undo'"
                                           onclick="BackToList()">返回</a>*@
                </td>
            </tr>
        </table>
        </form>
    </div>
</div>
